import { request } from '@/utils/request.js'

/**
 * 派送单 API JS
 */

export default {

  /**
   * 获取派送单分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'document/sendOrder/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加派送单
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'document/sendOrder/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新派送单数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'document/sendOrder/update/' + id,
      method: 'put',
      data
    })
  },
  updateStatus (id, data = {}) {
    return request({
      url: 'document/sendOrder/updateStatus/' + id,
      method: 'put',
      data
    })
  },

  /**
   * 读取派送单
   * @returns
   */
  read (id) {
    return request({
      url: 'document/sendOrder/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将派送单删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'document/sendOrder/delete',
      method: 'delete',
      data
    })
  },
  //询价
  InquiryPrice (data,timeout) {
    return request({
      url: 'document/sendOrder/InquiryPrice',
      method: 'post',
      data,
      timeout:timeout
    })
  },
  //下单
  order (data,timeout) {
    return request({
      url: 'document/sendOrder/order',
      method: 'post',
      data,
      timeout:timeout
    })
  },
  //作废
  cancel (data) {
    return request({
      url: 'document/sendOrder/cancel',
      method: 'post',
      data
    })
  },
  saveOrder (data) {
    return request({
      url: 'document/sendOrder/saveOrder',
      method: 'post',
      data
    })
  },
  //同步
  synchronous (data) {
    return request({
      url: 'document/sendOrder/synchronous',
      method: 'post',
      data
    })
  },
  //下载
  downloadZip (data,timeout) {
    return request({
      url: 'document/sendOrder/download',
      method: 'post',
      responseType: 'blob',
      data,
      timeout:timeout
    })
  },
}